package com.ruoyi.jproom.controller;

import com.ruoyi.jproom.service.AppUserService;
import com.ruoyi.jproom.service.ResidentialService;
import com.ruoyi.jproom.utils.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zeo
 * @explain 用户操作控制层
 * @date 2020/8/8 14:16
 */
@RequestMapping("/appUser")
@Controller
public class AppUserController {

    @Autowired
    AppUserService appUserService;

    @Autowired
    ResidentialService residentialService;

    /**
     * 新增关注
     * @param userId
     * @param followId
     * @return
     */
    @RequestMapping("/insertFollow")
    @ResponseBody
    public BaseResult insertFollow(String userId, String followId) {
        return appUserService.insertFollow(userId,followId);
    }

    /**
     * 取消关注
     * @param userId
     * @param followId
     * @return
     */
    @RequestMapping("/cancelFollow")
    @ResponseBody
    public BaseResult cancelFollow(String userId, String followId){
        return appUserService.cancelFollow(userId,followId);
    }

    /**
     * 判断某个用户是否关注
     * @param userId
     * @param followId
     * @return
     */
    @RequestMapping("/isFollow")
    @ResponseBody
    public BaseResult isFollow(String userId, String followId){
        return appUserService.isFollow(userId,followId);
    }



    /**
     * 获取小区及房源关注数量
     * @param userId
     * @return
     */
    @RequestMapping("/findFollowCount")
    @ResponseBody
    public BaseResult findFollowCount(String userId){
        return appUserService.findFollowCount(userId);
    }


}
